#include <iostream>
using namespace std;

int main()
{
    int n , k;
    cin >> n >> k;
    int res = n % k;
    cout << k - res << endl;
    return 0;
}